int rob(int* nums, int numsSize)
{
    int *max_sum = (int *)malloc(numsSize * sizeof(int));
    int tmp = 0;

    for(int i = 0; i < numsSize; i++)
    {
        tmp = nums[i];
        if(i - 2 >= 0)
        {
            tmp = tmp > (max_sum[i - 2] + nums[i]) ? tmp : (max_sum[i - 2] + nums[i]);
        }
        if(i - 1 >= 0)
        {
            tmp = tmp > max_sum[i - 1] ? tmp : max_sum[i - 1];
        }
        max_sum[i] = tmp;
    }

    return max_sum[numsSize - 1];
}



